package com.chianghao.core.mybatis.sql;

public class MiniSeq {


    private static long currentMillisecond = System.currentTimeMillis();

    private static int currentIndex  = 0;

    public static synchronized String getNextId(){
        if(System.currentTimeMillis()!=currentMillisecond){
            currentMillisecond = System.currentTimeMillis();
            currentIndex = 0;
        }
        currentIndex += 1;
        int temp= (int) (currentMillisecond<<8);
        return temp+"_"+currentIndex;
    }


//    public static void main(String[] args) {
//        long beginTime  = System.currentTimeMillis();
//        while(System.currentTimeMillis()-beginTime<1000){
//            System.out.println(getNextId());
//        }
//    }

}
